import { Form } from './Form';
import { RequestMethod } from './RequestMethod';


export type RawDataContent = string | ArrayBuffer | object;

export type RequestContent = RawDataContent | Form | undefined

export enum ContentType {
  urlencoded = "application/x-www-form-urlencoded",
  multipart = "multipart/form-data",
  json = "application/json",
  xml = "text/xml",
  text = 'text/plain',
  stream = 'application/octet-stream'
}

//export type ContentType = 'application/json' | 'text/plain' | 'multipart/form-data' | 'application/octet-stream' | 'application/x-www-form-urlencoded' | (string & NonNullable<unknown>);

//export type HeaderValue = Record<string, undefined | string | number | boolean>

/**
 * HTTP request predefined content coding types.
 * @typedef ContentCoding
 * @syscap SystemCapability.Collaboration.RemoteCommunication
 * @since 4.1.0(11)
 */
export type ContentCoding = 'aes128gcm' | 'br' | 'compress' | 'deflate' | 'exi' | 'gzip' | 'pack200-gzip' | 'x-compress'
  | 'x-gzip' | 'zstd' | (string & NonNullable<unknown>);

export type RequestHeaders = {
  [k: string]: string | string[] | undefined;
  'authorization'?: string;
  'accept'?: ContentType | ContentType[];
  'accept-charset'?: string | string[];
  'accept-encoding'?: ContentCoding | ContentCoding[];
  'accept-language'?: string | string[];
  'cache-control'?: string | string[];
  'cookie'?: string | string[];
  'range'?: string | string[];
  'upgrade'?: string | string[];
  'user-agent'?: string;
  'content-type'?: ContentType;
};

export type ResponseHeaders = {
  [k: string]: string | string[] | undefined;
  'accept-ranges'?: 'none' | 'bytes' | (string & NonNullable<unknown>);
  'allow'?: RequestMethod | RequestMethod[];
  'cache-control'?: string | string[];
  'content-encoding'?: string;
  'content-range'?: string;
  'content-type'?: ContentType;
  'date'?: string;
  'etag'?: string;
  'expires'?: string;
  'location'?: string;
  'retry-after'?: string;
  'set-cookie'?: string | string[];
  'server'?: string;
  'www-authenticate'?: string | string[];
};